<template>
<van-tabs v-on="$listeners" v-bind="$attrs" @click="click" @change="change">
  <!-- <template v-for="(index, name) in $slots" v-slot:[name]>
      <slot :name="name"/>
  </template> -->
  <template v-if="dataSource.length>0">
      <van-tab
        v-for="(item, index) in dataSource"
        :title="item.title"
        :key="index"
      >
        <slot/>
      </van-tab>
  </template>
</van-tabs>
</template>
<script>
export default {
  name: "eagle-tabs",
  props: {
    dataSource:{
        type:Array,
        default:function(){
            return [];
        }
    }
  },
  methods:{
    click(name,title){
      this.$emit("click",name,title);
      if(name==0){
        this.change(name,title);
      }
    },
    change(name,title){
        this.$emit("change",name,title);
    },
  }
};
</script>